package ling.archives.domain;

import com.easy.query.core.enums.RelationTypeEnum;
import com.easy.query.core.proxy.ProxyEntityAvailable;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import ling.archives.domain.proxy.DocumentClassProxy;
import lombok.Data;
import com.easy.query.core.annotation.*;
import ling.archives.common.domain.entity.*;

import javax.validation.constraints.NotBlank;

/**
 * 文件分类;
 * @author : He-LiangLiang@Outlook.com
 * @date : 2025-4-2
 */
@ApiModel(value = "文件分类",description = "")
@Table("ar_document_class")
@EntityProxy
@Data
public class DocumentClass extends IUpdatedEntity.LongId implements Serializable,Cloneable, ProxyEntityAvailable<DocumentClass , DocumentClassProxy> {
    /** id */
    /*
    @Column(primaryKey = true)
    @ApiModelProperty(value = "id",notes = "")
    private Long id ;
    */
    public String gianFullPath(){
        if(StringUtils.isBlank(path))
            return getId()+"";
        return  path+"/"+getId();
    }
    /** 名称 */
    @ApiModelProperty(value = "名称",notes = "")
    @NotBlank(message = "标题不能为空")
    @EasyWhereCondition
    private String title ;


    /** 上级 */
    @ApiModelProperty(value = "上级",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    private Long parentId ;


    /** 路径 */
    @ApiModelProperty(value = "路径",notes = "")
    private String path ;

    /** 物理路径 */
    @ApiModelProperty(value = "物理路径",notes = "")
    private String dirPath ;
    /** 类型，0分类，1标签 */
    @ApiModelProperty(value = "类型，0分类，1标签",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    private Integer type ;


    /** 值：year,town */
    @ApiModelProperty(value = "值：year,town",notes = "")
    private String val ;


    /** 说明 */
    @ApiModelProperty(value = "说明",notes = "")
    private String remark ;




    @Navigate(value = RelationTypeEnum.OneToMany,targetProperty = "parentId", selfProperty = "id")
    List<DocumentClass> children=new ArrayList<>();


}
